<?php
require_once '../sub/init.php';
$currfields = 'sex,grade,openid,subscribe,money';
require_once ZEAI.'m/my_chk_u.php';
require_once ZEAI.'cache/config_vip.php';$viewlist = json_decode($_VIP['viewlist'],true);
require_once ZEAI.'cache/udata.php';
$t = (ifint($t,'1-2','1'))?$t:1;
$cook_grade = intval($row['grade']);
$cook_sex   = intval($row['sex']);
if ($submitok == 'ajax_clean'){
	$db->query("DELETE FROM ".__TBL_CLICKHISTORY__." WHERE uid=".$cook_uid);
	json_exit(array('flag'=>1));
}
switch ($t) {
	case 1:$t_str='谁看过我';break;
	case 2:$t_str='我看过谁';break;
}
$nodatatips="<div class='nodatatips'><i class='ico'>&#xe608;</i>暂时木有内容呀～～</div>";
function rows_ulist($rows,$p) {
	global $_ZEAI,$t;
	$id      = $rows['id'];
	$uid     = $rows['uid'];
	$new     = $rows['new'];
	$addtime_str = date_str($rows['addtime']);
	$new_str = ($new == 1)?'<b></b>':'';
	//
	$nickname = trimhtml(dataIO($rows['nickname'],'out'));
	$sex      = $rows['sex'];
	$grade    = $rows['grade'];
	$photo_s  = $rows['photo_s'];
	$photo_f  = $rows['photo_f'];
	$areatitle= $rows['areatitle'];
	$birthday = $rows['birthday'];
	$edu      = $rows['edu'];
	$pay      = $rows['pay'];
	$heigh    = $rows['heigh'];
	$flag     = $rows['flag'];
	$photo_ifshow = $rows['photo_ifshow'];
	//$pay_str       = (empty($pay))?'':''.'<b>/</b>'.udata('pay',$pay);
	$edu_str       = (empty($edu))?'':''.'<b>/</b>'.udata('edu',$edu);
	$birthday_str  = (getage($birthday)<=0)?'':getage($birthday).'岁';
	$heigh_str     = (empty($heigh))?'':'<b>/</b>'.$heigh.'cm';
	$aARR = explode(' ',$areatitle);$areatitle = $aARR[1].$aARR[2];
	$areatitle_str = (empty($areatitle))?'':'<b>/</b>'.$areatitle;
	$photo_s_url=photo_s_out('{"smb":"s","sex":"'.$sex.'","photo_s":"'.$photo_s.'","photo_f":"'.$photo_f.'","photo_ifshow":"'.$photo_ifshow.'","uflag":"'.$flag.'","outkind":"url"}');
	if($flag==-2)$nickname='***';
	$O  = '<dl>';
	$O .= '<dt><a href="'.a('{"kind":"u","uid":"'.$uid.'"}').'"><img src="'.$photo_s_url.'"></a></dt>';
	$O .= '<dd><h4>'.uicon($sex.$grade).$nickname.'</h4><h6>'.$birthday_str.$heigh_str.$edu_str.$pay_str.$areatitle_str.'</h6></dd>';
	$O .= '<span>'.$addtime_str.'</span>';
	$O .= '</dl>';
	return $O;
}
$_ZEAI['pagesize'] = 15;
switch ($t) {
	case 1:
		$ZEAI_SQL = "a.uid=".$cook_uid." AND a.senduid=b.id";
		$ZEAI_SELECT="SELECT a.id,a.senduid AS uid,a.new,a.addtime,b.nickname,b.sex,b.grade,b.photo_s,b.photo_f,b.areatitle,b.birthday,b.edu,b.pay,b.heigh,b.flag,b.photo_ifshow FROM ".__TBL_CLICKHISTORY__." a,".__TBL_USER__." b WHERE ".$ZEAI_SQL." ORDER BY a.addtime DESC";
	break;
	case 2:
		$ZEAI_SQL = "a.senduid=".$cook_uid." AND a.uid=b.id";
		$ZEAI_SELECT="SELECT a.id,a.addtime,a.uid,b.nickname,b.sex,b.grade,b.photo_s,b.photo_f,b.areatitle,b.birthday,b.heigh,b.flag,b.photo_ifshow FROM ".__TBL_CLICKHISTORY__." a,".__TBL_USER__." b WHERE ".$ZEAI_SQL." ORDER BY a.addtime DESC";
	break;
}
if($submitok=='ZEAI_list'){exit(Zeai_ajax_list_fn($ZEAI_totalP,$p));}
$rtt=$db->query("SELECT COUNT(*) FROM ".__TBL_CLICKHISTORY__." a,".__TBL_USER__." b WHERE ".$ZEAI_SQL);
$roww = $db->fetch_array($rtt,'num');
$ZEAI_total = $roww[0];
$ZEAI_totalP= ceil($ZEAI_total/$_ZEAI['pagesize']);
$nav='my';?>
<!doctype html><html><head><meta charset="utf-8">
<title>我的-<?php echo $_ZEAI['siteName'];?></title>
<?php echo HEADMETA; ?>
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script>var t=<?php echo $t;?></script>
<style>
.tabmenu a.ed:after,#my_browse_del{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
header.bgcolor{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
#backtop a,.btmKefuBtn{color:<?php echo $_ZEAI['mob_mbcolor'];?>}
.my_browse{padding:0 1.5rem 10rem 1.5rem;margin-top:11rem}
.my_browse dl{border-bottom:#f5f5f5 1px solid;position:relative;height:7rem;box-sizing:border-box}
.my_browse dl dt,.my_browse dl dd{position:absolute;top:1.3rem}
.my_browse dl dt{width:6rem;left:0}
.my_browse dl dt img{width:4.4rem;height:4.4rem;border-radius:2.5rem;object-fit:cover;-webkit-object-fit:cover}
.my_browse dl dd{left:7rem;width:-webkit-calc(100% - 8rem);text-align:left}
.my_browse dl dd b{font-weight:normal;margin:0 .5rem;color:#ccc;font-size:1.2rem}
.my_browse dl dd h4{font-size:1.4rem}
.my_browse dl dd h6{width:100%;color:#999;margin-top:.3rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.my_browse dl span{color:#999;font-size:1.2rem;position:absolute;right:0;top:1.5rem}

#my_browse_del{display:inline-block;width:5rem;height:5rem;position:fixed;bottom:12rem;right:2rem;border-radius:4rem;color:#fff;z-index:1}
#my_browse_del i{font-size:2rem;margin-top:.5rem}
#my_browse_del span{font-size:1.2rem;display:block}

.viptips{width:90%;margin:12rem auto;background-color:#f8f8f8;padding:3rem 2rem;border-radius:1.2rem;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box}
.viptips font{width:100%;font-size:1.4rem;display:block;margin:0 auto;color:#999}
.viptips font b{color:#f00;margin:0 .2rem;font-weight:normal}
.viptips h5{margin:1rem auto 2rem auto}
.viptips .ivubox span{display:inline-block;width:4rem;height:4rem;border:.2rem solid #fff;border-radius:5rem;margin-left:-.8rem;overflow:hidden;transform:rotate(0deg);}
.viptips .ivubox span img{width:4rem;height:4rem;object-fit:cover;-webkit-object-fit:cover;overflow:hidden}
.viptips .ivubox span img.blur{filter:blur(.3rem);-webkit-filter:blur(.3rem);display:block}
<?php
if ($_ZEAI['m_mb']==2){
	echo '.TRnav_btn i{color:'.$_ZEAI['mob_mbcolor'].'}';
	echo '.tabmenufix{width:60%;max-width:500px;top:1.5rem;margin:auto;left:0;right:0}';
	echo '.my_browse{margin-top:5rem}';
	$mini_class='top_mini4';
}else{
	$mini_title=$t_str;
	echo '.tabmenufix{top:6.7rem}';
	$mini_class='top_mini4 zeaibg bgcolor yunbox';
}
?>
</style>
</head><body><?php
$mini_href ='zeai.openurl(\'my.php\');';
require_once ZEAI.'m/top_mini.php';?>
<div class="tabmenu tabmenu2 tabmenufix">
	<a href="my_browse.php?t=1"<?php echo ($t == 1)?' class="ed"':'';?>>谁看过我</a>
	<a href="my_browse.php?t=2"<?php echo ($t == 2)?' class="ed"':'';?>>我看过谁</a>
</div>
<?php if($t==1 && $viewlist[$cook_grade]==1)echo '<a id="my_browse_del"><i class="ico">&#xe779;</i><span>清空</span></a>';?>
<div class="my_browse" id="ZEAI_list">
	<?php if ($viewlist[$cook_grade]!=1 && $t==1){?>
	<div class="viptips">
		<?php 
		$vwnum = $db->COUNT(__TBL_CLICKHISTORY__,"uid=".$cook_uid);
		$rt=$db->query("SELECT a.senduid,a.new,a.addtime,b.sex,b.photo_s,b.photo_f,b.flag,b.photo_ifshow,b.flag FROM ".__TBL_CLICKHISTORY__." a,".__TBL_USER__." b WHERE a.senduid=b.id AND a.uid=".$cook_uid." ORDER BY a.addtime DESC LIMIT 6");
		$total = $db->num_rows($rt);
		if ($total > 0){
			echo '<div class="ivubox">';
			$viewblurClass = ($viewlist[$cook_grade]!=1)?' class="blur"':'';
			for($ii=1;$ii<=$total;$ii++) {
				$rows = $db->fetch_array($rt,'name');
				if(!$rows) break;
				$senduid = $rows['senduid'];
				$sex     = $rows['sex'];
				$new     = $rows['new'];
				$new_str = ($new == 1)?'<b></b>':'';
				$photo_s  = $rows['photo_s'];
				$photo_f  = $rows['photo_f'];
				$flag     = $rows['flag'];
                $photo_ifshow = $rows['photo_ifshow'];
                $uflag = $rows['flag'];
				$photo_s_url=photo_s_out('{"smb":"s","sex":"'.$sex.'","photo_s":"'.$photo_s.'","photo_f":"'.$photo_f.'","photo_ifshow":"'.$photo_ifshow.'","uflag":"'.$uflag.'","outkind":"url"}');
				if($flag==-2)$nickname='***';
				echo '<span><img src="'.$photo_s_url.'"'.$viewblurClass.'></span>';
			}
			echo '</div>';
		}?>
        <font>最近有<b><?php echo $vwnum;?></b>人看过你</font>
        <h5>缘分就在一瞬间，不错过喜欢你的人</h5>
        <a href="my_vip.php" class="btn size3 zeaibg yuan" id="vipbtn">　<i class="ico">&#xe6ab;</i> 立即开通VIP查看　</a>
    </div>
	<?php exit;}?>
    <?php if($ZEAI_totalP>0){echo Zeai_ajax_list_fn($ZEAI_totalP,$p);}else{echo $nodatatips;}?>
</div>
<?php if ($ZEAI_total > $_ZEAI['pagesize']){?>
<script>
var ZEAI_totalP = parseInt(<?php echo $ZEAI_totalP; ?>),p=2;
zeaiOnscroll_json={url:'my_browse'+zeai.extname,data:{submitok:'ZEAI_list',ZEAI_totalP:ZEAI_totalP,t:<?php echo $t;?>}};
document.body.onscroll = zeaiOnscroll;
</script>
<div id="backtop"><a href="#top" id="btmTopBtn"><i class="ico">&#xe60c;</i>顶部</a></div>
<?php }?>
<?php if ($t == 1){?>
<script>
my_browse_del.onclick=function(){
	ZeaiM.confirmUp({title:'确定要清空浏览记录么？',cancel:'取消',ok:'清空',okfn:function(){
		zeai.ajax({url:'my_browse'+zeai.extname,data:{submitok:'ajax_clean'}},function(e){rs=zeai.jsoneval(e);
			if(rs.flag==1){ZEAI_list.html("<?php echo $nodatatips;?>");}
		});
	}});
}
</script>
<?php }
if($_ZEAI['m_mb']==2){
	require_once ZEAI.'m/bottom2.php';
}else{
	require_once ZEAI.'m/TRnav.php';
	require_once ZEAI.'m/bottom.php';
}
?>